package cn.bugstack.mybatis.plugin;


import java.util.Properties;

/**
 * 拦截器接口，拦截方法，执行插件逻辑
 * @author xingshujing
 */
public interface Interceptor {

    /**
     * 具体的拦截逻辑
     * @param invocation
     * @return
     * @throws Throwable
     */
    Object intercept(Invocation invocation) throws Throwable;

    /**
     * plugin interceptor into target
     * @param target
     * @return
     */
    default Object plugin(Object target) {
        return Plugin.wrap(target, this);
    }

    default void setProperties(Properties properties) {

    }
}
